<?php
namespace app\admin\validate;
use think\Validate;

/**
 * 工位信息验证器
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/09/19
 * Time: 09:50
 */
class WorkStation extends Validate{

    protected $rule = [
        'regionid'           => 'require',
        'number'             => 'require',
        'work_type'          => 'require',
        'measure'            => 'require|integer',
        'price'              => 'require|integer',
        'suggest_person_num' => 'require|integer',
        'window_direction'   => 'require',
        'is_indoor_air'      => 'require',
        'company_name'       => 'require',
        'company_person'     => 'require',
        'company_tel'        => 'require',
        'company_out_time'   => 'require|date',
        'company_in_time'    => 'require|date',
        'is_show_company'    => 'require'
    ];

    protected $message = [
        'regionid.require'           => '区域必须填写',
        'number.require'             => '工位编号必须填写',
        'work_type.require'          => '办公类型必须填写',
        'measure.require'            => '面积必须填写',
        'measure.integer'            => '面积填写错误',
        'price.require'              => '价格必须填写',
        'price.integer'              => '价格填写错误',
        'suggest_person_num.require' => '建议使用人数必须填写',
        'suggest_person_num.integer' => '建议使用人数填写错误',
        'window_direction.require'   => '窗户朝向必须填写',
        'is_indoor_air.require'      => '有无室内空调必须填写',
        'company_name.require'       => '公司名称必须填写',
        'company_person.require'     => '公司负责人必须填写',
        'company_tel.require'        => '公司电话必须填写',
        'company_out_time.require'   => '到期时间必须填写',
        'company_out_time.date'      => '到期时间填写错误',
        'company_in_time.require'    => '入住时间必须填写',
        'company_in_time.date'       => '入住时间填写错误',
        'is_show_company.require'    => '是否显示公司信息必须填写',
    ];

    protected $scene = [
        'add'          => ['regionid','number','work_type','price'],
        'edit_ws'      => ['number','work_type','measure','price','suggest_person_num','window_direction','is_indoor_air'],
        'edit_company' => ['company_out_time','company_in_time','is_show_company']
    ];
}